#include <iostream>
#include <vector>
#include "lib/binary_tree.h"
using namespace std;

bool isSymmetrical(BinaryTreeNode* root1, BinaryTreeNode* root2) {
  if (!root1 && !root2)
    return true;
  if (!root1 || !root2)
    return false;
  if (root1->value != root2->value)
    return false;

  return isSymmetrical(root1->left, root2->right) &&
         isSymmetrical(root1->right, root2->left);
}

bool test(const vector<int> &vec) {
  BinaryTreeNode* root = CreateBinaryTree(vec);
  bool ret = isSymmetrical(root, root);
  DeleteBinaryTree(root);
  return ret;
}

int main() {
  vector<int> vec1 = {8, 6, 6, 5, 7, 7, 5};
  cout << "test1: " << test(vec1) << endl;

  vector<int> vec2 = {8, 6, 9, 5, 7, 7, 5};
  cout << "test2: " << test(vec2) << endl;

  vector<int> vec3 = {8};
  cout << "test3: " << test(vec3) << endl;

  return 0;
}
